<template>
    <div class="language-switcher">
        <div v-if="languageStore.getLanguage === 'zh'" @click="switchLanguage('en')">EN</div>
        <div v-else @click="switchLanguage('zh')">CN</div>
    </div>
</template>

<script setup>
import EventBus from "@utils/EventBus.js";
import {useLanguageStore} from "@store";

const languageStore = useLanguageStore();

const switchLanguage = (lang) => {
    languageStore.setLanguage(lang);
    EventBus.$emit('language:update');
}
</script>

<style lang="scss" scoped>
.language-switcher div {
    cursor: pointer;
    color: inherit;
}
</style>
